import express from "express";
import { formatResponse } from "../../utils/tools";
import { getAccessPath, uploadMiddleware } from "../middlewares/uploadFile";
const router = express.Router();

router.post("/", uploadMiddleware().single("file"), async (req: any, res) => {
  res.send(
    formatResponse<any>(
      {
        name: req.file.filename,
        url: getAccessPath(req.file.filename),
      },
      "操作成功"
    )
  );
});

export default router;
